Skip to content

fix(tor): stop Tor from silently disabling Moshpit resolution - #54

Merged
ralyodio merged 2 commits into
mainfrom
fix/tor-bypass-registry
Jul 31, 2026
Merged

fix(tor): stop Tor from silently disabling Moshpit resolution#54
ralyodio merged 2 commits into
mainfrom
fix/tor-bypass-registry

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

The bug

With Tor on, only loopback bypassed the SOCKS proxy:

bypassList: ['localhost', '127.0.0.1', '[::1]']

So the registry lookup that sits in front of every Moshpit navigation went out over Tor. A cold circuit doesn't answer inside the 4s lookup budget → lookupMoshpit returns null → resolution falls back to clearnet.

That's the correct failure mode for a registry that's down, and completely wrong for one that was merely slow. The symptom is a Moshpit name resolving as an ordinary domain — indistinguishable from the name not existing. Nothing errors, nothing logs, the feature just stops working while Tor is on.

The fix

The pit's own hosts now bypass Tor alongside loopback. Built from the configured bases rather than hardcoded, so a self-hosted pit gets the same treatment as the public one, and read at enable time because the options page can repoint the registry between one toggle and the next.

Lookup budget goes 4s → 8s in both the TS module and its extension port. 4s was tight for a phone on a bad connection. It's a budget for a check that blocks navigation, not a guess at a worst case — exceeding it still falls back to clearnet.

The privacy trade, stated plainly

Bypassing means the network path sees which Moshpit names are looked up, and the registry sees the real IP.

Neither was hidden before: the registry is told the name either way, and app.moshcode.sh is where the account is signed in. So Tor was protecting close to nothing on this leg, at the cost of the feature working at all. The reasoning is in a comment next to moshpitBypassHosts so the next person can disagree with it on the merits.

This does not change .onion handling — SOCKS5 still resolves DNS at the proxy for everything not on the bypass list.

Tests

7 new, including that both ports agree on the budget — moshpit.js is a hand port of moshpit-resolve.ts and already has a faithfulness test; this keeps the new constant honest. Edge cases covered: self-hosted base, port stripping, unparseable/missing bases (throwing here would leave the proxy unset while the badge says TOR).

91/91 across the desktop suite.

🤖 Generated with Claude Code

ralyodio and others added 2 commits July 31, 2026 09:33
With Tor on, only loopback bypassed the SOCKS proxy, so the registry lookup
that sits in front of every Moshpit navigation went out over Tor. A cold
circuit does not answer inside the lookup budget, the lookup returns null, and
resolution falls back to clearnet — which is the correct failure mode for a
registry that is down, and completely wrong for one that was merely slow. The
symptom is a Moshpit name resolving as an ordinary domain, indistinguishable
from the name not existing.

The pit's own hosts now bypass Tor alongside loopback. Built from the
configured bases rather than hardcoded, so a self-hosted pit gets the same
treatment as the public one, and read at enable time because the options page
can repoint the registry between one toggle and the next.

The privacy trade is deliberate and written down next to the code: bypassing
means the network path sees which Moshpit names are looked up and the registry
sees the real IP. Neither was hidden before — the registry is told the name
either way, and the console is where the account is signed in — so Tor was
protecting close to nothing on this leg, at the cost of the feature working.

The lookup budget goes 4s -> 8s in both the TS module and its extension port.
4s was tight for a phone on a bad connection; it is a budget for a check that
blocks navigation, not a guess at a worst case, and exceeding it still falls
back to clearnet.

7 new tests, including that both ports agree on the budget — the two copies of
this policy already have a faithfulness test and this keeps it honest. 91
across the desktop suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apps/desktop/package-lock.json was never tracked; it appeared because the
previous commit's tests were run with npm in a fresh worktree. This repo is
pnpm@9.12.0 with a single pnpm-lock.yaml, and a stray npm lockfile beside it
is a second, disagreeing source of truth for the same dependency tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit 8db94f1 into main Jul 31, 2026
7 checks passed
@ralyodio
ralyodio deleted the fix/tor-bypass-registry branch July 31, 2026 09:36
@ralyodio ralyodio mentioned this pull request Jul 31, 2026
ralyodio added a commit that referenced this pull request Jul 31, 2026
Ships the Tor fix (#54): with Tor on, only loopback bypassed the SOCKS proxy,
so the registry lookup in front of every Moshpit navigation went out over Tor.
A cold circuit does not answer inside the lookup budget, so resolution fell
back to clearnet — correct for a registry that is down, wrong for one that was
merely slow, and indistinguishable from the name not existing.

The pit's own hosts now bypass Tor alongside loopback, computed from the
configured bases so a self-hosted pit is covered too. The lookup budget goes
4s -> 8s in both the policy module and its extension port.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant